/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * PantallaGestionEventos.java
 *
 * Created on 10-may-2011, 23:18:10
 */

package edu.uoc.tds.cliente;

import java.rmi.RemoteException;
import java.util.Date;
import java.util.Vector;

import javax.swing.JOptionPane;

import edu.uoc.tds.bean.Evento;
import edu.uoc.tds.bean.TipoEvento;
import edu.uoc.tds.common.EGestioEventsException;
import edu.uoc.tds.common.MostrarCombo;
import edu.uoc.tds.common.RemotoInterface;
import edu.uoc.tds.common.UtilLenguaje;
import edu.uoc.tds.common.Utils;
import edu.uoc.tds.common.Variables;

/**
 *
 * @author Alejandro Navarro
 */
public class PantallaGestionEventos extends javax.swing.JPanel {
	private static final long serialVersionUID = 71346326811966015L;
	private RemotoInterface objServeis;
	private int accion = 0;
	private Integer idEvento;

    /** Creates new form PantallaGestionEventos */
    public PantallaGestionEventos(RemotoInterface objServeis, int accion) {
        super();
        this.objServeis = objServeis;
        this.accion = accion;
        initComponents();
    }

    public int getAccion() {
		return accion;
	}

	public void setAccion(int accion) {
		this.accion = accion;
	}

	public void rellenarEvento(Integer idEvento) {
    	try {
    		Evento evento = objServeis.getEvento(idEvento);
    		this.idEvento = idEvento;
    		nombre.setText(evento.getNombre());
    		comboTipoEvento.getModel().setSelectedItem(new MostrarCombo(evento.getTipoEvento().getId_evento(), evento.getTipoEvento().getDescripcion()));
    		fechaInicio.setText(Utils.convertirFecha(evento.getFechaInicio()));
    		fechaFin.setText(Utils.convertirFecha(evento.getFechaFin()));
    		umbral.setText(String.valueOf(evento.getUmbral()));
    		precio.setText(String.valueOf(evento.getPrecio()));
    		umbral.setText(String.valueOf(evento.getDuracion()));
    		plazas.setText(String.valueOf(evento.getCapacidad()));
    		duracion.setText(String.valueOf(evento.getDuracion()));
    		descripcion.setText(evento.getDescripcion());
    	} catch (RemoteException re) {
    		Utils.tratarRemoteException(re);
    	}
    }

    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jScrollPane2 = new javax.swing.JScrollPane();
        jTable1 = new javax.swing.JTable();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        nombre = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        comboTipoEvento = new javax.swing.JComboBox();
        jLabel8 = new javax.swing.JLabel();
        fechaInicio = new javax.swing.JTextField();
        jLabel9 = new javax.swing.JLabel();
        fechaFin = new javax.swing.JTextField();
        jLabel10 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        umbral = new javax.swing.JTextField();
        precio = new javax.swing.JTextField();
        duracion = new javax.swing.JTextField();
        jLabel15 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        plazas = new javax.swing.JTextField();
        jLabel13 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        descripcion = new javax.swing.JTextArea();
        jLabel14 = new javax.swing.JLabel();
        jScrollPane3 = new javax.swing.JScrollPane();
        jTable2 = new javax.swing.JTable();
        botonPrerequisitos = new javax.swing.JButton();
        botonGuardar = new javax.swing.JButton();
        botonVolver = new javax.swing.JButton();

        jScrollPane2.setName("jScrollPane2"); // NOI18N

        jTable1.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        jTable1.setName("jTable1"); // NOI18N
        jScrollPane2.setViewportView(jTable1);

        jLabel1.setText(UtilLenguaje.getMessage("pantGestionEventos.nombre.centro"));
        jLabel1.setName("jLabel1"); // NOI18N

        jLabel2.setText(Variables.usuarioConectado.getCentroDocente().getNombre());
        jLabel2.setName("jLabel2"); // NOI18N

        jLabel3.setText(UtilLenguaje.getMessage("pantGestionEventos.codigo.centro"));
        jLabel3.setName("jLabel3"); // NOI18N

        jLabel4.setText(String.valueOf(Variables.usuarioConectado.getCentroDocente().getIdCentroDocente()));
        jLabel4.setName("jLabel4"); // NOI18N

        jLabel5.setText(UtilLenguaje.getMessage("pantGestionEventos.datos.evento"));
        jLabel5.setName("jLabel5"); // NOI18N

        jLabel6.setText(UtilLenguaje.getMessage("pantGestionEventos.nombre.evento"));
        jLabel6.setName("jLabel6"); // NOI18N

        nombre.setText("");
        nombre.setName("jTextField1"); // NOI18N

        jLabel7.setText(UtilLenguaje.getMessage("pantGestionEventos.tipo.evento"));
        jLabel7.setName("jLabel7"); // NOI18N

        comboTipoEvento.setName("jComboBox1"); // NOI18N
        comboTipoEvento.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "" }));
		try {
	        Vector<MostrarCombo> listaTipoEventos = objServeis.listaTipoEventos();
	        comboTipoEvento.setModel(new javax.swing.DefaultComboBoxModel(listaTipoEventos));
		} catch (RemoteException re) {
			Utils.tratarRemoteException(re);
		}


        jLabel8.setText(UtilLenguaje.getMessage("pantGestionEventos.comienzo.evento"));
        jLabel8.setName("jLabel8"); // NOI18N

        fechaInicio.setText("");
        fechaInicio.setName("jTextField2"); // NOI18N

        jLabel9.setText(UtilLenguaje.getMessage("pantGestionEventos.fin.evento"));
        jLabel9.setName("jLabel9"); // NOI18N

        fechaFin.setText("");
        fechaFin.setName("jTextField3"); // NOI18N

        jLabel10.setText(UtilLenguaje.getMessage("pantGestionEventos.umbral.evento"));
        jLabel10.setName("jLabel10"); // NOI18N

        jLabel11.setText(UtilLenguaje.getMessage("pantGestionEventos.precio.evento"));
        jLabel11.setName("jLabel11"); // NOI18N

        jLabel15.setText(UtilLenguaje.getMessage("pantGestionEventos.duracion.evento"));
        jLabel15.setName("jLabel15");

        duracion.setText("");
        duracion.setName("jTextField7");

        umbral.setText("");
        umbral.setName("jTextField4"); // NOI18N

        precio.setText("");
        precio.setName("jTextField5"); // NOI18N

        jLabel12.setText(UtilLenguaje.getMessage("pantGestionEventos.plazas.evento"));
        jLabel12.setName("jLabel12"); // NOI18N

        plazas.setText("");
        plazas.setName("jTextField6"); // NOI18N

        jLabel13.setText(UtilLenguaje.getMessage("pantGestionEventos.desc.evento"));
        jLabel13.setName("jLabel13"); // NOI18N

        jScrollPane1.setName("jScrollPane1"); // NOI18N

        descripcion.setColumns(20);
        descripcion.setRows(5);
        descripcion.setName("jTextArea1"); // NOI18N
        jScrollPane1.setViewportView(descripcion);

        jLabel14.setText(UtilLenguaje.getMessage("pantGestionEventos.requisitos.evento"));
        jLabel14.setName("jLabel14"); // NOI18N

        jScrollPane3.setName("jScrollPane3"); // NOI18N

        jTable2.setModel(new javax.swing.table.DefaultTableModel(null,
            new String [] {
                UtilLenguaje.getMessage("pantGestionEventos.codigo.prereq"),
                UtilLenguaje.getMessage("pantGestionEventos.nombre.prereq")
            }
        ));
        jTable2.setName("jTable2"); // NOI18N
        jTable2.setEnabled(false);
        jScrollPane3.setViewportView(jTable2);

        botonPrerequisitos.setText(UtilLenguaje.getMessage("pantGestionEventos.boton.modificar"));
        botonPrerequisitos.setName("jButton1"); // NOI18N
        botonPrerequisitos.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
            	jPrerequisitosActionPerformed(evt);
            }
        });

        if (Variables.MODIFICACION == accion) {
            botonGuardar.setText(UtilLenguaje.getMessage("pantGestionEventos.boton.modificar"));
            botonGuardar.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                	jButton2ModifActionPerformed(evt);
                }
            });
            botonPrerequisitos.setEnabled(true);
            umbral.setEditable(false);
        } else if (Variables.ALTA == accion) {
            botonGuardar.setText(UtilLenguaje.getMessage("pantGestionEventos.boton.alta"));
            botonGuardar.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                	jButton2AltaActionPerformed(evt);
                }
            });
            botonPrerequisitos.setEnabled(false);
        }
        botonGuardar.setName("jButton2"); // NOI18N


        botonVolver.setText(UtilLenguaje.getMessage("pantGestionEventos.boton.volver"));
        botonVolver.setName("jButton3"); // NOI18N
        botonVolver.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
            	jVolverActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel5)
                            .addComponent(jLabel10)
                            .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel6)
                                    .addComponent(jLabel8)
                                    .addComponent(jLabel12)
                                    .addComponent(jLabel13)
                                    .addComponent(jLabel14))
                                .addGap(29, 29, 29)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addGroup(layout.createSequentialGroup()
                                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                            .addComponent(plazas, javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(umbral, javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(fechaInicio, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 133, Short.MAX_VALUE))
                                        .addGap(35, 35, 35)
                                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(jLabel9)
                                            .addComponent(jLabel11)
                                            .addComponent(jLabel15))
                                        .addGap(32, 32, 32)
                                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                        	.addComponent(duracion)
                                            .addComponent(precio)
                                            .addComponent(fechaFin, javax.swing.GroupLayout.DEFAULT_SIZE, 143, Short.MAX_VALUE)))
                                    .addGroup(layout.createSequentialGroup()
                                        .addComponent(nombre, javax.swing.GroupLayout.PREFERRED_SIZE, 285, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(18, 18, 18)
                                        .addComponent(jLabel7)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(jLabel3)
                                            .addComponent(comboTipoEvento, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addGroup(layout.createSequentialGroup()
                                                .addGap(10, 10, 10)
                                                .addComponent(jLabel4))))
                                    .addGroup(layout.createSequentialGroup()
                                        .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 270, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addComponent(botonPrerequisitos))
                                    .addComponent(jScrollPane1)))))
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabel1))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(34, 34, 34)
                        .addComponent(jLabel2))
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(botonGuardar)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(botonVolver)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(jLabel4))
                .addGap(37, 37, 37)
                .addComponent(jLabel5)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel6)
                    .addComponent(jLabel7)
                    .addComponent(comboTipoEvento, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(nombre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(fechaInicio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel8)
                    .addComponent(jLabel9)
                    .addComponent(fechaFin, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel10)
                    .addComponent(jLabel11)
                    .addComponent(umbral, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(precio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel12)
                    .addComponent(jLabel15)
                    .addComponent(plazas, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(duracion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel13)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel14))
                        .addGap(59, 59, 59)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(botonGuardar)
                            .addComponent(botonVolver)))
                    .addComponent(botonPrerequisitos))
                .addContainerGap(276, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void jButton2AltaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField3ActionPerformed
    	try {
    		if (validarFormatoDatos()) {
    			Evento evento = obtenerEvento();
    			idEvento = objServeis.insertarEvento(evento);
                JOptionPane.showMessageDialog(null, UtilLenguaje.getMessage("pantGestionEventos.conf.alta.desc"),
                		UtilLenguaje.getMessage("pantGestionEventos.conf.alta.titulo"), JOptionPane.INFORMATION_MESSAGE);
                accion = Variables.MODIFICACION;
                botonGuardar.setText(UtilLenguaje.getMessage("pantGestionEventos.boton.modificar"));
                botonGuardar.addActionListener(new java.awt.event.ActionListener() {
                    public void actionPerformed(java.awt.event.ActionEvent evt) {
                    	jButton2ModifActionPerformed(evt);
                    }
                });
                botonPrerequisitos.setEnabled(true);
                umbral.setEditable(false);
    		}
    	} catch (RemoteException re) {
    		Utils.tratarRemoteException(re);
    	} catch (EGestioEventsException e) {
    		Utils.tratarEGestioEventsException(e);
    	}
    }

    private void jButton2ModifActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField3ActionPerformed
    	try {
    		if (validarFormatoDatos()) {
    			Evento evento = obtenerEvento();
    			evento.setIdEvento(idEvento);
        		objServeis.modificarEvento(evento);
                JOptionPane.showMessageDialog(null, UtilLenguaje.getMessage("pantGestionEventos.conf.modif.desc"),
                		UtilLenguaje.getMessage("pantGestionEventos.conf.modif.titulo"), JOptionPane.INFORMATION_MESSAGE);
    		}
    	} catch (RemoteException re) {
    		Utils.tratarRemoteException(re);
    	} catch (EGestioEventsException e) {
    		Utils.tratarEGestioEventsException(e);
    	}
    }

    private void jVolverActionPerformed(java.awt.event.ActionEvent evt) {
    	PantallaCalendarioEventos pantallaCalendarioEventos = (PantallaCalendarioEventos) this.getParent().getComponent(0);
    	this.setVisible(false);
    	this.getParent().remove(1);
    	pantallaCalendarioEventos.setVisible(true);
    }

    private void jPrerequisitosActionPerformed(java.awt.event.ActionEvent evt) {
    	PantallaEventoRequisitos pantallaEventoRequisitos = new PantallaEventoRequisitos(objServeis, idEvento);
    	pantallaEventoRequisitos.setVisible(false);
    	this.setVisible(false);
	    this.getParent().add(pantallaEventoRequisitos);
    	this.getParent().remove(1);
	    pantallaEventoRequisitos.setVisible(true);
    }

    private Evento obtenerEvento() {
    	Evento evento = new Evento();

    	evento.setNombre(nombre.getText());
    	evento.setDescripcion(descripcion.getText());
    	evento.setFechaInicio(Utils.convertirFecha(fechaInicio.getText()));
    	evento.setFechaFin(Utils.convertirFecha(fechaFin.getText()));
    	evento.setFechaAlta(new Date());
    	evento.setUmbral(Utils.convertirInteger(umbral.getText()));
    	evento.setPrecio(Utils.convertirDouble(precio.getText()));
    	evento.setDuracion(Utils.convertirInteger(duracion.getText()));
    	evento.setCapacidad(Utils.convertirInteger(plazas.getText()));
    	evento.setCentroDocente(Variables.usuarioConectado.getCentroDocente());
    	evento.setTipoEvento(new TipoEvento(new Integer(((MostrarCombo) comboTipoEvento.getSelectedItem()).getID())));
    	evento.setUniversidad(Variables.usuarioConectado.getCentroDocente().getUniversidad());
    	evento.setEstado(new Integer(Variables.estadoActivo));

    	return evento;
    }

    private boolean validarFormatoDatos() throws EGestioEventsException {
    	String campoFormato = null;

    	if (!Utils.isEmpty(fechaInicio.getText()) && !Utils.isDate(fechaInicio.getText())) {
    		campoFormato = "pantGestionEventos.err.fechaini.formato";
    	} else if (!Utils.isEmpty(fechaFin.getText()) && !Utils.isDate(fechaFin.getText())) {
    		campoFormato = "pantGestionEventos.err.fechafin.formato";
    	} else if (!Utils.isEmpty(umbral.getText()) && !Utils.isNumber(umbral.getText())) {
    		campoFormato = "pantGestionEventos.err.umbral.formato";
    	} else if (!Utils.isEmpty(precio.getText()) && !Utils.isDouble(precio.getText())) {
    		campoFormato = "pantGestionEventos.err.precio.formato";
    	} else if (!Utils.isEmpty(plazas.getText()) && !Utils.isNumber(plazas.getText())) {
    		campoFormato = "pantGestionEventos.err.plazas.formato";
    	} else if (!Utils.isEmpty(duracion.getText()) && !Utils.isNumber(duracion.getText())) {
    		campoFormato = "pantGestionEventos.err.duracion.formato";
    	} else if (!Utils.isEmpty(nombre.getText()) && nombre.getText().length() > 40) {
    		campoFormato = "pantGestionEventos.err.nombre.formato";
    	} else if (!Utils.isEmpty(descripcion.getText()) && descripcion.getText().length() > 255) {
    		campoFormato = "pantGestionEventos.err.descripcion.formato";
    	}

    	if (campoFormato != null) {
        	EGestioEventsException e = new EGestioEventsException();
    		e.setDescripcion(campoFormato);
    		e.setTitulo("pantGestionEventos.err.titulo.campos.formato");
    		throw e;
    	}

    	return true;
    }


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton botonPrerequisitos;
    private javax.swing.JButton botonGuardar;
    private javax.swing.JButton botonVolver;
    private javax.swing.JComboBox comboTipoEvento;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JTable jTable1;
    private javax.swing.JTable jTable2;
    private javax.swing.JTextArea descripcion;
    private javax.swing.JTextField nombre;
    private javax.swing.JTextField fechaInicio;
    private javax.swing.JTextField fechaFin;
    private javax.swing.JTextField umbral;
    private javax.swing.JTextField precio;
    private javax.swing.JTextField plazas;
    private javax.swing.JTextField duracion;
}
